var cart = {

    api_name: '/api/cart',

  // 添加购物车
  addToCart(skuId, skuNum) {
    return request({
      url: this.api_name + '/addToCart/' + skuId + '/' + skuNum,
      method: 'post'
    })
  },

  // 我的购物车
  cartList() {
    return request({
      url: this.api_name + '/cartList',
      method: 'get'
    })
  },

  // 更新选中状态
  checkCart(skuId, isChecked) {
    return request({
      url: this.api_name + '/checkCart/' + skuId + '/' + isChecked,
      method: 'get'
    })
  },

// 刪除
  deleteCart(skuId) {
    return request({
      url: this.api_name + '/deleteCart/' + skuId,
      method: 'delete'
    })
  },
  // 全选或全不选
  checkCartAllTo(isChecked) {
      return request({
        url: this.api_name + '/checkCartAllTo/'+isChecked,
        method: 'get'
      })
  },
  //添加到收藏
  addCollect(skuId) {
      return request({
        url: this.api_name + '/addCollect/' + skuId,
        method: 'post'
      })
  },
  //取消收藏
  cancelCollect(skuId) {
      return request({
        url: this.api_name + '/cancelCollect/' + skuId,
        method: 'delete'
      })
  },
  //显示收藏列表
  collectList(){
    return request({
      url: this.api_name + '/collectList',
      method: 'get'
      })
  },
  //删除收藏
  removeCollect(skuId){
      return request({
        url: this.api_name + '/removeCollect/' + skuId,
        method: 'delete'
      })
  }
}
